<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Setting extends Model
{
    use HasFactory;

    // 设置setting常量
    const SETTINGS = [
        'site_setting' => [
            'site_logo' => '',
            'site_slogan' => '',
            'site_name' => '',
            'site_code' => ''
        ],
        'oss' => [
            'access_key' => '',
            'secret_key' => '',
            'bucket' => '',
            'endpoint' => '',
            'is_name' => false
        ],
        'sms' => [
            'access_key' => '',
            'secret_key' => '',
            'sign_tem' => '',
            'sign_name' => '',
        ],
        'authorization_login' => [
            'authorization_model' => [
                'disable' => false,
                'manual_authorization' => true,
                'auto_authorization' => false,
            ],
            'authorization_url' => '',
            'authorization_token_url' => '',
            'user_url' => '',
            'client_id' => '',
            'client_secret' => '',
        ],
        'user_agreement' => [
            'title' => '用户注册保密协议标题',
            'confidentiality_agreement' => '用户注册保密协议内容'
        ],
        'technical_help' => [
            'content' => '技术帮助内容'
        ],
        'toefl_ibt' => [
            'title' => '考试须知标题',
            'content' => '考试须知内容'
        ],
        'emigrated_roles' => [
            'title' => '闯关规则标题',
            'content' => '闯关规则内容'
        ]
    ];

    // 不自动维护时间戳
    public $timestamps = false;

    protected $fillable = ['cn_name', 'value'];
    /**
     * 类型转换
     *
     * @var array
     */
    protected $casts = [
        'value' => 'array',
    ];
}
